import requests
from common.token_data import TokenTool

"""
查询指定部门名称ID
department_name:部门名称
"""


def inquire_department(department_name):
    resp = requests.get("https://heimahr.itheima.net/api/company/department", headers=TokenTool.token_data())

    for i in resp.json().get("data"):
        if i.get("name") == department_name:
            return i.get("id")
    return "没有该部门，请添加！！！"


if __name__ == '__main__':
    print(inquire_department("寻找部门ID"))
